package org.web.datajpa.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.web.datajpa.domain.Student;

import java.util.List;

@Repository
public interface StudentRepository extends JpaRepository<Student, Long> {
    // 姓名模糊查询学生
    List<Student> findByNameContaining(String name);

    @Modifying
    @Query("DELETE FROM student s WHERE s.studentId IN :ids")
    void deleteByIds(List<Integer> ids);
}
